package com.iuv.shortmsgnotice.domain;

import com.iuv.shortmsgnotice.util.IuvDateUtil;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Calendar;
import java.util.Date;

/**
 * DemoSmsExpressTbl
 * 快递信息登记表
 *
 * @author Will
 * @date 14:57
 */
@Entity
public class DemoSmsExpressTbl {
    /**
     * 快递ID
     */
    private Integer expressId;
    /**
     * 客户名称
     */
    private String customerName;
    /**
     * 手机号码
     */
    private String mobile;
    /**
     * 取件码
     */
    private String pickUpCode;
    /**
     * 入库时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date inTime;
    /**
     * 出库时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date outTime;
    /**
     * 备注
     */
    private String remark;
    public DemoSmsExpressTbl() {
    }
    public DemoSmsExpressTbl(String customerName, String mobile, String pickUpCode, String remark) {
        this.customerName = customerName;
        this.mobile = mobile;
        this.pickUpCode = pickUpCode;
        this.remark = remark;
        this.inTime=Calendar.getInstance().getTime();
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getExpressId() {
        return expressId;
    }

    public void setExpressId(Integer expressId) {
        this.expressId = expressId;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getPickUpCode() {
        return pickUpCode;
    }

    public void setPickUpCode(String pickUpCode) {
        this.pickUpCode = pickUpCode;
    }

    @Transient
    public String getInTimeString() {
        return IuvDateUtil.formatDate(inTime, IuvDateUtil.DATE_TIME_FORMAT);
    }

    public Date getInTime() {
        return inTime;
    }

    public void setInTime(Date inTime) {
        this.inTime = inTime;
    }

    @Transient
    public String getOutTimeString() {
        return IuvDateUtil.formatDate(outTime, IuvDateUtil.DATE_TIME_FORMAT);
    }

    public Date getOutTime() {
        return outTime;
    }

    public void setOutTime(Date outTime) {
        this.outTime = outTime;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
